extends ../layout

block content
  if post.title
    h1 Editing #{post.title}
  else
    h1 New Post

  include ../messages

  form#post(action='/post' + (post.title ? '/' + post.id : ''), method='post')
    if post.title
      input(type='hidden', name='_method', value='put')
    p
      label(for='post[title]') Title:
      input(type='text', name='post[title]', value=post.title)
    p
      label(for='post[body]') Body:
      textarea(name='post[body]')= post.body || ''
    p
      input(type='submit', value=post.title ? 'Update' : 'Create')
    